package org.example;

public class 第十一章_StringBuffer和StringBuilder类 {
    public static void main(String[] args) {
        //创建StringBuilder对象
        StringBuilder stringBuilder = new StringBuilder();
        //创建StringBuffer对象
        StringBuffer stringBuffer = new StringBuffer();

        //追加字符串
        stringBuilder.append("111111111111");
        stringBuffer.append("asssqqqqqqqqqss");
        //插入字符串
        stringBuffer.insert(2,"44444444");
        stringBuilder.insert(2,"qdqdwqdqwq");
        //删除字符串
        stringBuffer.delete(2,2);
        stringBuilder.delete(2,4);

        System.out.println("StringBuilder: " + stringBuilder.toString());
        System.out.println("StringBuffer: " + stringBuffer.toString());
    }
}
